<?php
function mecho($param) {
	echo "<br>".$param."<br>";
}
// encode

$org = '<h2>I am H2 text</h2>';
echo 'original: ' . $org;
echo 'use htmlscecialchars: ' . htmlspecialchars($org);
/*
変換前		変換後
　&			&amp;
　"			&quot;
　'			&#039;
　<			&lt;
　>			&gt;
　
*/

// url encode, decode

$link = 'http://a.com?c=1';
mecho(urlencode($link));

// buyer
$encode = "%5Fsite%3D8%26%5Farticle%3D4412%26%5Fref%3Dhttp%253A%2F%2Flocalhost%2Feclipse%2Fadmage%2Fmedia%2Ddien001%2F%26%5Fnocache%3D1386575596107";
mecho(urldecode($encode));

$encode = "%5Fsite%3D8%26%5Farticle%3D4412%26%5Fref%3Dhttp%253A%2F%2Flocalhost%2Feclipse%2Fadmage%2Fmedia%2Ddien001%2F%26%5Fnocache%3D1386575596107";
mecho(urldecode($encode));
